home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / curspriv.h < prev    next >
C/C++ Source or Header  |  1993-10-29  |  11KB  |  332 lines

  1. /*
  2. * $Header: C:\CURSES\RCS\curspriv.h 2.1 1993/06/18 20:18:46 MH Rel MH $
  3. *
  4. *                          CURSPRIV.H
  5. *
  6. * Header file for definitions and declarations for the
  7. * PDCurses package. These definitions should not be generally
  8. * accessible to programmers, but are provided if the applications
  9. * programmer decides to make the decision in favor of speed on a
  10. * PC over portability.
  11. *
  12. * Revision History:
  13. * Frotz 1.5Beta 900714  Added many levels of compiler support.
  14. *                       Added mixed prototypes for all "internal" routines.
  15. *                       Removed all assembly language.  Added EGA/VGA
  16. *                       support.  Converted all #ifdef to #if in all
  17. *                       modules except CURSES.H and CURSPRIV.H.
  18. *                       Always include ASSERT.H.  Added support for an
  19. *                       external malloc(), calloc() and free().
  20. *                       Added support for FAST_VIDEO (direct-memory writes).
  21. *                       Added various memory model support (for FAST_VIDEO).
  22. *                       Added much of the December 1988 X/Open Curses
  23. *                       specification.
  24. * bl    1.3     881005  All modules lint-checked with MSC '-W3' and turbo'C'
  25. *                       '-w -w-pro' switches.
  26. * bl    1.2     881002  Support (by #ifdef UCMASM) for uppercase-only
  27. *                       assembly routine names. If UCMASM if defined,
  28. *                       all assembler names are #defined as upper case.
  29. *                       Not needed if you do "MASM /MX. Also missing
  30. *                       declaration of cursesscroll(). Fixes thanks to
  31. *                       N.D. Pentcheff
  32. * bl    1.1     880306  Add _chadd() for raw output routines.
  33. * bl    1.0     870515  Release.
  34. *
  35. */
  36.  
  37. #ifndef __CURSES_INTERNALS__
  38. #define __CURSES_INTERNALS__
  39.  
  40. /* Always include... */
  41. #include <assert.h>
  42.  
  43.  
  44.  
  45. /*----------------------------------------------------------------------
  46. *       MEMORY MODEL SUPPORT:
  47. *
  48. *       MODELS
  49. *               TINY            cs,ds,ss all in 1 segment (not enough memory!)
  50. *               SMALL           cs:1 segment,           ds:1 segment
  51. *               MEDIUM          cs:many segments        ds:1 segment
  52. *               COMPACT         cs:1 segment,           ds:many segments
  53. *               LARGE           cs:many segments        ds:many segments
  54. *               HUGE            cs:many segments        ds:segments > 64K
  55. */
  56. #ifdef  __TINY__
  57. #  define SMALL 1
  58. #endif
  59. #ifdef  __SMALL__
  60. #  define SMALL 1
  61. #endif
  62. #ifdef  __MEDIUM__
  63. #  define MEDIUM 1
  64. #endif
  65. #ifdef  __COMPACT__
  66. #  define COMPACT 1
  67. #endif
  68. #ifdef  __LARGE__
  69. #  define LARGE 1
  70. #endif
  71. #ifdef  __HUGE__
  72. #  define HUGE 1
  73. #endif
  74.  
  75.  
  76. /*----------------------------------------------------------------------
  77. *       OPERATING SYSTEM SUPPORT:
  78. *
  79. *               DOS             The one we all know and love:-}
  80. *               OS/2            The new kid on the block.
  81. *               FLEXOS          A Real-time, protected-mode OS from
  82. *                               Digital Research, Inc.
  83. *                (AKA, the 4680 from IBM...)
  84. */
  85.  
  86. /*----------------------------------------*/
  87. #ifdef  DOS
  88. #  define FAST_VIDEO 1          /* We can write directly to the screen. */
  89.    typedef union REGS Regs;
  90.    extern Regs regs;
  91. #  ifdef GO32
  92. #    define _FAR_POINTER(s,o)    (0xe0000000 + s*16 + o)
  93. #    define _FP_SEGMENT(p)        (unsigned short)((((long)fp) >> 4) & 0xffff)
  94. #    define _FP_OFFSET(p)        ((unsigned short)fp & 0x000f)
  95. #  else
  96. #    ifdef __TURBOC__
  97. /*#      define _FAR_POINTER(s,o)    ((unsigned long)s * 16 + (unsigned long)o)*/
  98. #      define _FAR_POINTER(s,o)    MK_FP(s,o)
  99. #    else
  100. #      define _FAR_POINTER(s,o)    (((long)s << 16) | (long)o)
  101. #    endif
  102. #    define _FP_SEGMENT(p)        (unsigned short)(((long)fp) >> 4)
  103. #    define _FP_OFFSET(p)        ((unsigned short)fp & 0x000f)
  104. #  endif
  105.  
  106. #  ifdef GO32
  107.      unsigned char getdosmembyte (int offs);    /* see: private\_dosmem.c */
  108.      unsigned short getdosmemword (int offs);
  109.      void setdosmembyte (int offs, unsigned char b);
  110.      void setdosmemword (int offs, unsigned short w);
  111. #  else
  112. #    if SMALL || MEDIUM || MSC
  113. #      define getdosmembyte(offs)    (*((unsigned char far *) _FAR_POINTER(0,offs)))
  114. #      define getdosmemword(offs)    (*((unsigned short far *) _FAR_POINTER(0,offs)))
  115. #      define setdosmembyte(offs,x)  (*((unsigned char far *) _FAR_POINTER(0,offs)) = (x))
  116. #      define setdosmemword(offs,x)  (*((unsigned short far *) _FAR_POINTER(0,offs)) = (x))
  117. #    else
  118. #      define getdosmembyte(offs)    (*((unsigned char *) _FAR_POINTER(0,offs)))
  119. #      define getdosmemword(offs)    (*((unsigned short *) _FAR_POINTER(0,offs)))
  120. #      define setdosmembyte(offs,x)  (*((unsigned char *) _FAR_POINTER(0,offs)) = (x))
  121. #      define setdosmemword(offs,x)  (*((unsigned short *) _FAR_POINTER(0,offs)) = (x))
  122. #    endif
  123. #  endif
  124. #endif
  125.  
  126. /*----------------------------------------*/
  127. #ifdef  FLEXOS
  128. #  define FAST_VIDEO 1          /* We can use scopy()   */
  129. #  define GMODE  0 /* KLUDGE ALERT!
  130.                    * GMODE == 0 defines character mode structures in FLEXTAB.H.
  131.                    * GMODE == 1 defines graphics  mode structures in FLEXTAB.H.
  132.                    */
  133. #include <flextab.h>
  134. extern VIRCON vir;
  135. #endif
  136.  
  137.  
  138.  
  139.  
  140. /*----------------------------------------------------------------------
  141. *       MALLOC DEBUGGING SUPPORT:
  142. *
  143. *       Set EMALLOC and EMALLOC_MAGIC in order to use your private
  144. *       versions of malloc(), calloc(), and free().  This can help,
  145. *       but not solve, your malloc problems when debugging...
  146. *
  147. */
  148. #ifndef    INTERNAL
  149. #  define EMALLOC 0             /* Disable External Malloc            */
  150. #else
  151. #  define EMALLOC 0             /* Enable/Disable External Malloc       */
  152. #  define EMALLOC_MAGIC  0x0C0C /* Our magic indicator that we should   */
  153.                                 /* use our external malloc rather than  */
  154.                                 /* the runtime's malloc.                */
  155. #endif
  156.  
  157.  
  158. /*----------------------------------------------------------------------*/
  159. /* window properties */
  160. #define _SUBWIN         0x01    /* window is a subwindow            */
  161. #define _ENDLINE        0x02    /* last winline is last screen line */
  162. #define _FULLWIN        0x04    /* window fills screen              */
  163. #define _SCROLLWIN      0x08    /* window lwr rgt is screen lwr rgt */
  164. #define _PAD            0x10    /* X/Open Pad.                      */
  165.  
  166.  
  167.  
  168.  
  169. /*----------------------------------------------------------------------*/
  170. /* Miscellaneous */
  171. #define _INBUFSIZ       512     /* size of terminal input buffer */
  172. #define _NO_CHANGE      -1      /* flags line edge unchanged     */
  173.  
  174.  
  175.  
  176.  
  177. /* @@@ THESE SHOULD BE INDIVIDUAL FUNCTIONS, NOT MACROS! */
  178. #define _BCHAR          0x03    /* Break char        (^C)         */
  179. #define _ECHAR          0x08    /* Erase char        (^H)         */
  180. #define _DWCHAR         0x17    /* Delete Word char (^W)         */
  181. #define _DLCHAR         0x15    /* Delete Line char (^U)         */
  182. #define _GOCHAR         0x11    /* ^Q character                  */
  183. #define _PRINTCHAR      0x10    /* ^P character                  */
  184. #define _STOPCHAR       0x13    /* ^S character                  */
  185. #define  NUNGETCH       20      /* max # chars to ungetch()      */
  186.  
  187.  
  188.  
  189.  
  190. /* Setmode stuff */
  191. struct cttyset
  192. {
  193.     bool    been_set;
  194.     SCREEN    saved;
  195. };
  196.  
  197. extern struct cttyset c_sh_tty;         /* tty modes for shell_mode */
  198. extern struct cttyset c_pr_tty;         /* tty modes for prog_mode  */
  199. extern struct cttyset c_save_tty;
  200. extern struct cttyset c_save_trm;
  201.  
  202. /* Printscan stuff */
  203. extern char c_printscanbuf[];           /* buffer used during I/O */
  204.  
  205. /* tracing flag */
  206. extern bool trace_on;
  207.  
  208. /* Strget stuff */
  209. extern char*    c_strbeg;
  210.  
  211. /* doupdate stuff */
  212. extern WINDOW*  twin;                   /* used by many routines */
  213.  
  214. /* Monitor (terminal) type information */
  215. #define _NONE           0x00
  216. #define _MDA            0x01
  217. #define _CGA            0x02
  218. #define _EGACOLOR       0x04
  219. #define _EGAMONO        0x